package sys.utils;

import sys.entity.RoleEntity;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author Administrator
 */
public class TestUtiles {

    public static void main(String[] args) {
        List<RoleEntity> roleList = new ArrayList<RoleEntity>();
        RoleEntity r1 = new RoleEntity();
        r1.setRoleName("管理员");
        r1.setId(1);
        r1.setCreateTime(new Date());
        r1.setSex("男");
        RoleEntity r2 = new RoleEntity();
        r2.setRoleName("CEO");
        r2.setId(2);
        r2.setCreateTime(new Date());
        r2.setSex("男");
        RoleEntity r3 = new RoleEntity();
        r3.setRoleName("部门经理");
        r3.setId(3);
        r3.setCreateTime(new Date());
        r3.setSex("女");
        roleList.add(r1);
        roleList.add(r2);
        roleList.add(r3);

      /* List<String> roleNameList = new ArrayList<>();
        for(RoleEntity roleEntity:roleList){
            roleNameList.add(roleEntity.getRoleName());
        }*/
        List<Integer> roleNameList = roleList.stream().map(RoleEntity::getId).collect(Collectors.toList());
        long count = roleList.stream().filter(roleEntity -> roleEntity.getSex() == "男").count();
        System.out.println(count);


    }
}
